package vip.liux.backend.application.service.pay.dto.channel;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import vip.liux.contracts.infrastructure.pay.PayClientConfig;
import vip.liux.core.utils.JsonUtils;

import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PayChannelDto extends PayChannelBaseDto {

    private Long id;

    private LocalDateTime creationTime;

    private String code;

    private String config;

    @JsonIgnore
    private PayClientConfig configObject;

    public PayClientConfig setConfig(PayClientConfig config) {
        this.config = JsonUtils.toJson(config);
        this.configObject = config;
        return this.configObject;
    }
}
